Telegram Group & Telegram Channel
Note #29 Testing.short или разделяем тестовые прогоны 📝

Недавно наткнулся на интересную тему: разделение Go тестов на быстрые или медленные те например unit и integration tests. Все собрал в короткую заметку:

A) Стандартный подход использую `testing.Short` [2]:
func TestQuick(t *testing.T) {
...
}

func TestTimeConsuming(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
}

Если выполнить:
$ go test -short
То мы пропустим тест TestTimeConsuming и выполним только TestQuick

B) Использовать build tags самый, на мой взгляд, гибкий подход:
Те создаем integration_test.go файл и добавляем билд тэги [1]:
// +build integration

func TestTimeConsuming(t *testing.T) {
// ...
}

Далее просто запускаем:
$ go test -tags=integration

С) Использовать -test.run RegExp [2]:
Можно именовать тесты с префиксом понятным всей команде:
func TestQuickUnit(t *testing.T) {
...
}

func TestIntegraion(t *testing.T) {
...
}

И далее просто:
$ go test -run Integration
$ go test -run Unit

P.S. еще как вариант можно добавить разделение с помощью переменных окружения
А как сделано в вашем проекте? Поделиться можно в личку или чат
Links:
[1] https://golang.org/pkg/go/build/
[2] https://golang.org/cmd/go/#hdr-Testing_flags
[3] https://golang.org/pkg/testing/



tg-me.com/golang_for_two/54
Create:
Last Update:

Note #29 Testing.short или разделяем тестовые прогоны 📝

Недавно наткнулся на интересную тему: разделение Go тестов на быстрые или медленные те например unit и integration tests. Все собрал в короткую заметку:

A) Стандартный подход использую `testing.Short` [2]:

func TestQuick(t *testing.T) {
...
}

func TestTimeConsuming(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
}

Если выполнить:
$ go test -short
То мы пропустим тест TestTimeConsuming и выполним только TestQuick

B) Использовать build tags самый, на мой взгляд, гибкий подход:
Те создаем integration_test.go файл и добавляем билд тэги [1]:
// +build integration

func TestTimeConsuming(t *testing.T) {
// ...
}

Далее просто запускаем:
$ go test -tags=integration

С) Использовать -test.run RegExp [2]:
Можно именовать тесты с префиксом понятным всей команде:
func TestQuickUnit(t *testing.T) {
...
}

func TestIntegraion(t *testing.T) {
...
}

И далее просто:
$ go test -run Integration
$ go test -run Unit

P.S. еще как вариант можно добавить разделение с помощью переменных окружения
А как сделано в вашем проекте? Поделиться можно в личку или чат
Links:
[1] https://golang.org/pkg/go/build/
[2] https://golang.org/cmd/go/#hdr-Testing_flags
[3] https://golang.org/pkg/testing/

BY 🇺🇦 Go for two :)


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/golang_for_two/54

View MORE
Open in Telegram


🇺🇦 Go на двоих Telegram | DID YOU KNOW?

Date: |

That strategy is the acquisition of a value-priced company by a growth company. Using the growth company's higher-priced stock for the acquisition can produce outsized revenue and earnings growth. Even better is the use of cash, particularly in a growth period when financial aggressiveness is accepted and even positively viewed.he key public rationale behind this strategy is synergy - the 1+1=3 view. In many cases, synergy does occur and is valuable. However, in other cases, particularly as the strategy gains popularity, it doesn't. Joining two different organizations, workforces and cultures is a challenge. Simply putting two separate organizations together necessarily creates disruptions and conflicts that can undermine both operations.

What is Telegram Possible Future Strategies?

Cryptoassets enthusiasts use this application for their trade activities, and they may make donations for this cause.If somehow Telegram do run out of money to sustain themselves they will probably introduce some features that will not hinder the rudimentary principle of Telegram but provide users with enhanced and enriched experience. This could be similar to features where characters can be customized in a game which directly do not affect the in-game strategies but add to the experience.

🇺🇦 Go на двоих from hk


Telegram 🇺🇦 Go for two :)
FROM USA